<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      var n = 0;
      var zongshu = 0;
      var num = parseInt(prompt("请输入一个数字。"));
      for (i = 3; i <= num + 1; i++) {
        for (j = 2; j < i - 1; j++) {}
        // console.log("i是" + i);
        // console.log("J是" + j);
        n = i / j;
        zongshu += n;
        console.log(i + "/" + j + "是" + n);
      }
      alert("总数是：" + zongshu);
      console.log("总数是：" + zongshu);

      // 22题
      // var a = parseFloat(prompt("请输入一个数字"));
      // var n = 0;
      // for (var i = 2; i <= a; i++) {
      //     n += ((i + 1) / i);
      // }
      // console.log(n)
    </script>
  </head>
  <body></body>
</html>
